import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login.vue'
import Welcome from '../views/welcome/welcome'

import PMO from '../views/pmo/templateConfig'
import Project from '../views/project/assessment'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: '/welcome',
    children: [
      {
        path: '/welcome',
        component: Welcome
      },
      {
        path: '/project',
        name: 'Project',
        component: Project
      },
      {
        path: '/pmo',
        name: 'PMO',
        component: PMO
      },

    ]
  },
]
const router = new VueRouter({
  routes
})



// router.beforeEach((to, from, next) => {
// 	//如果用户访问登录页，直接放行。
//     if (to.path === '/login') return next();
    
//     //从sessionStorage中获取到保存的token值
//     const tokenStr = window.sessionStorage.getItem('sessionId');
//     //没有token, 强制跳转到登陆页
//     if(!tokenStr)  return next('/login');
//     next();
// })










export default router
